from django.test import TestCase

# Create your tests here.
import os
import sys


def main():
    """Run administrative tasks."""
    os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ending_framework_api.settings.dev')
    import django
    django.setup()
    from user.models import Department
    # department = request.query_params.get('department', None)  # [1, 2]
    name = ''
    department = '[4, 5, 6]'
    import ast

    # 定义包含列表形式的字符串
    department_str = '[4, 5, 6]'

    # 使用ast.literal_eval()将字符串转换为列表
    department_list = ast.literal_eval(department_str)

    print(department_list)  # 输出: [4, 5, 6]

    print(department_list, type(department_list))
    for i in department_list:
        print(i)
    # print(department)
    # for depar in department:
    #     department_obj = Department.objects.all().filter(id=depar).first()
    #     print(department_obj)
    #     queryset = queryset.filter(name__icontains=name, department__name__icontains=department_obj.name)
    #     return queryset



main()